package com.norteksoft.erm.model;

import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 用户附件
 * 
 * @hibernate.class table="ERM_USERFILE" dynamic-insert="true"
 *                  dynamic-update="true"
 * @author Jiffy
 * 
 */

public class UserFile extends BaseObject {

	private static final long serialVersionUID = -9183265417087606909L;

	public static final String TYPE_FACE = "face";// 用户照片

	public static final String TYPE_SIGNET = "signet";// 用户印章

	private Long OID = new Long(-1);// OID

	private String fileName;// 附件名称

	private String fileType;// 附件类型

	private Long fileSize;// 附件大小

	private User user;

	private UserFileContent userFileContent;// 附件内容

	public int hashCode() {
		return new HashCodeBuilder().append(OID).append(fileName).append(
				fileType).append(fileSize).toHashCode();
	}

	/**
	 * @hibernate.id column="OID" unsaved-value="-1" type="long"
	 * @hibernate.generator class="sequence"
	 * @hibernate.param name="sequence" value="ERM_SEQUENCE"
	 */

	public Long getOID() {
		return OID;
	}

	public void setOID(Long oid) {
		OID = oid;
	}

	/**
	 * @hibernate.property column="FILENAME" type="string" length="500"
	 * @return String
	 */
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	/**
	 * @hibernate.property column="FILETYPE" type="string" length="10"
	 * @return String
	 */

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	/**
	 * @hibernate.property column="FILESIZE" type="long"
	 * @return long
	 */
	public Long getFileSize() {
		return fileSize;
	}

	public void setFileSize(Long fileSize) {
		this.fileSize = fileSize;
	}

	/**
	 * @hibernate.one-to-one class="com.norteksoft.erm.model.UserFileContent"
	 *                       cascade="all" lazy="proxy" outer-join="auto"
	 *                       constrained="false"
	 * @return UserFileContent
	 */

	public UserFileContent getUserFileContent() {
		return userFileContent;
	}

	public void setUserFileContent(
			UserFileContent userFileContent) {
		this.userFileContent = userFileContent;
	}

	/**
	 * @hibernate.many-to-one name="user" column="USERID"
	 *                        class="com.norteksoft.erm.model.User"
	 */
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}
